import React,{ useState,useEffect,useCallback } from 'react';

function ResizeApp(){
    const [size,setSize] = useState({
        width:document.documentElement.clientWidth,
        height:document.documentElement.clientHeight
    })
    function resize(){
        console.log("reso123123")
        setSize({
            width:document.documentElement.clientWidth,
            height:document.documentElement.clientHeight
        })
    }
    useEffect(()=>{
        window.addEventListener("resize",resize)
        return ()=>{
            window.removeEventListener("resize",resize)
        }
    },[])
    return (<div>
        <p>窗口大小：{size.width}x{size.height}</p>
    </div>)
}

export default ResizeApp